//
//  NearbyUserModelList.swift
//  Swift-TableView-Example
//
//  Created by Bilal ARSLAN on 11/10/14.
//  Copyright (c) 2014 Bilal ARSLAN. All rights reserved.
//

import Foundation
import UIKit
import Alamofire

class NearbyUserModelList : UITableViewCell {
    
    @IBOutlet weak var PortailImage: UIImageView!
    @IBOutlet weak var PlateNumber: UILabel!
    @IBOutlet weak var UserSex: UIImageView!
    @IBOutlet weak var UserDistance: UILabel!
    
    var BaseimageUrl = "http://imgfm.qichexiaozi.com/"
    
    func configurateTheCell(UserModel:NearbyUserModel) {
        self.PlateNumber?.text  = UserModel.PlateNumStr
        
        if UserModel.UserSexStr == "男" {
            self.UserSex.image      = UIImage(named: "nan")
        }else {
            self.UserSex.image      = UIImage(named: "nv")
        }
        
        let imageUrl = BaseimageUrl + UserModel.PortailHeaderStr
        print(imageUrl)
        
        Alamofire.request(.GET, imageUrl).response() {
            (_, _, data, _) in
            self.PortailImage.image = UIImage(data: data! as NSData)
        }
        
        self.UserDistance.text  = UserModel.DistanceStr + "米以内"

    }
    
}